<?php
/**
 * Constant888 is a singleton pattern 
 * Single pattern: only one instance of this class is allowed to be instantiated
 * Reference: http://www.weberdev.com/get_example-4002.html
 */

if (!defined("CONSTANT888_PHS")) {
	define("CONSTANT888_PHS",1);	
	class Constant888 {
		static private $instance;
		private $NO_RESULT_FILE_STRING;
		private $SMARTY_DIR_PATH;
		private $MAX_SCREEN_WIDTH; //cell phone screen width
		private $WAP_ROOT_DIR_PATH;
		private $XML_HEADER;
		private $CONFIG_FILE_NAME;
		private $DATABASE_NAME;
		private $LOTTO_RESULT_TABLE;
		private $TIME_ZONE_STRING;
		private $MAX_STORED_DAYS;
		private $MB_AREA_CODE; 
		private $SEPARATED_LINE;
		private $RESULT_FILE_NAME = array();
		
		private function Constant888() {
			$this -> NO_RESULT_FILE_STRING = "Ket qua hien dang duoc update, xin thu lai sau 30s";
			$this -> SMARTY_DIR_PATH = dirname(__FILE__).'\..\Smarty-2.6.26';
			$this -> MAX_SCREEN_WIDTH = 22;
			$this -> WAP_ROOT_DIR_PATH = dirname(__FILE__).'\..';
			
			$this -> XML_HEADER = 
			'<?xml version="1.0" encoding="utf-8" ?>'."\n"
			.'<ketqua888>'."\n".
			'<xsmb  ';			
			
			$this -> CONFIG_FILE_NAME = $this -> WAP_ROOT_DIR_PATH . '\\'. 'wap888.cfg';
			$this -> DATABASE_NAME = "new_ketqua888";
			$this -> LOTTO_RESULT_TABLE = "store_result";
			$this -> TIME_ZONE_STRING ='Asia/Ho_Chi_Minh';
			$this -> MB_AREA_CODE = 1; 
			$this -> SEPARATED_LINE = '<b> -------------- </b>';
			
			$this -> RESULT_FILE_NAME[1] = "Luu_KQ_MB";
			$this -> MAX_STORED_DAYS = 7;
		}
		
		static public function instance() {
			if (!self::$instance) {
				self::$instance = new Constant888();
			}
			return self::$instance;
		}
		
		public function value($constName) {
			return $this -> $constName; 
		}

		public function resultFileName($areaCode) {
			return $this -> RESULT_FILE_NAME[$areaCode];
		}
	}
	
			
}
?>